package com.ruoyi.web.controller.datastatistics;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.datastatistics.domain.ElectricityTerminalsFreezeXb;
import com.ruoyi.datastatistics.service.IElectricityTerminalsFreezeXbService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 电冻结数据（设备维度）Controller
 * 
 * @author gdqt
 * @date 2025-03-10
 */
@RestController
@RequestMapping("/datastatistics/electricityTerminalsFreezeXb")
public class ElectricityTerminalsFreezeXbController extends BaseController
{
    @Autowired
    private IElectricityTerminalsFreezeXbService electricityTerminalsFreezeXbService;

    /**
     * 查询电冻结数据（设备维度）列表
     */
    @PreAuthorize("@ss.hasPermi('datastatistics:electricityTerminalsFreezeXb:list')")
    @GetMapping("/list")
    public TableDataInfo list(ElectricityTerminalsFreezeXb electricityTerminalsFreezeXb)
    {
        startPage();
        List<ElectricityTerminalsFreezeXb> list = electricityTerminalsFreezeXbService.selectElectricityTerminalsFreezeXbList(electricityTerminalsFreezeXb);
        return getDataTable(list);
    }

    /**
     * 导出电冻结数据（设备维度）列表
     */
    @PreAuthorize("@ss.hasPermi('datastatistics:electricityTerminalsFreezeXb:export')")
    @Log(title = "电冻结数据（设备维度）", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ElectricityTerminalsFreezeXb electricityTerminalsFreezeXb)
    {
        List<ElectricityTerminalsFreezeXb> list = electricityTerminalsFreezeXbService.selectElectricityTerminalsFreezeXbList(electricityTerminalsFreezeXb);
        ExcelUtil<ElectricityTerminalsFreezeXb> util = new ExcelUtil<ElectricityTerminalsFreezeXb>(ElectricityTerminalsFreezeXb.class);
        util.exportExcel(response, list, "电冻结数据（设备维度）数据");
    }

    /**
     * 获取电冻结数据（设备维度）详细信息
     */
    @PreAuthorize("@ss.hasPermi('datastatistics:electricityTerminalsFreezeXb:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(electricityTerminalsFreezeXbService.selectElectricityTerminalsFreezeXbById(id));
    }

    /**
     * 新增电冻结数据（设备维度）
     */
    @PreAuthorize("@ss.hasPermi('datastatistics:electricityTerminalsFreezeXb:add')")
    @Log(title = "电冻结数据（设备维度）", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ElectricityTerminalsFreezeXb electricityTerminalsFreezeXb)
    {
        return toAjax(electricityTerminalsFreezeXbService.insertElectricityTerminalsFreezeXb(electricityTerminalsFreezeXb));
    }

    /**
     * 修改电冻结数据（设备维度）
     */
    @PreAuthorize("@ss.hasPermi('datastatistics:electricityTerminalsFreezeXb:edit')")
    @Log(title = "电冻结数据（设备维度）", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ElectricityTerminalsFreezeXb electricityTerminalsFreezeXb)
    {
        return toAjax(electricityTerminalsFreezeXbService.updateElectricityTerminalsFreezeXb(electricityTerminalsFreezeXb));
    }

    /**
     * 删除电冻结数据（设备维度）
     */
    @PreAuthorize("@ss.hasPermi('datastatistics:electricityTerminalsFreezeXb:remove')")
    @Log(title = "电冻结数据（设备维度）", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(electricityTerminalsFreezeXbService.deleteElectricityTerminalsFreezeXbByIds(ids));
    }
}
